package com.qtest.qandroid.util;

import com.qtest.qandroid.entity.AttendanceJob;
import com.qtest.qandroid.entity.AttendanceRecord;
import net.sf.ezmorph.object.DateMorpher;
import net.sf.json.util.JSONUtils;

import java.util.Date;

/**
 * @author Yu
 * @time 2019/11/27 12:14
 */
public class timecha{
       private  static long nd = 1000*24*60*60;
       private  static long nh = 1000*60*60;
       private  static long nm = 1000*60;

       public static Boolean exJob(Date da, Date attendanceRecordTime){
           long diff = attendanceRecordTime.getTime()-da.getTime();
           long min = diff %nd %nh /nm;
           if (min<=5 && min>=0){
               return true;
           }
           else return false;
       }

    public static Boolean exStu(Date da, Date attendanceRecordTime){
        long diff = attendanceRecordTime.getTime()-da.getTime();
        long min = diff %nd %nh /nm;
        if (min<=5 && min>=0){
            return true;
        }
        else return false;
    }


       public static void change(){
           String[] dateFormats = new String[]{"yyyy-MM-dd HH:mm:ss"};
           JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(new String[]{"yyyy-MM-dd HH:mm:ss"}));
       }

}
